//
//  KwSegViewHelper.m
//  KuWoCan
//
//  Created by hwd on 17/3/20.
//  Copyright © 2017年 hwd. All rights reserved.
//

#import "KwSegViewHelper.h"

NSInteger kwSegView_SelectNum;

@implementation KwSegViewHelper

- (instancetype)init
{
    if (self = [super init])
    {
        [self addObserver:self forKeyPath:@"kwSegIndex" options:NSKeyValueObservingOptionNew context:nil];
    }
    return self;
}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context
{
    [[NSNotificationCenter defaultCenter] postNotificationName:KwSegViewNotification object:nil userInfo:@{KwNotificationInfoKey_Index:@(_kwSegIndex)}];
}

- (void)dealloc
{
    [self removeObserver:self forKeyPath:@"kwSegIndex"];
}

@end
